CC = g++
LDFLAGS = -lncurses 
OPTFLAGS = -g
INCLUDE = -Isrc/ -I/usr/local/include
WARNS = -Wall -Wextra -Wno-unused-parameter
CFLAGS = $(WARNS) -fPIC $(INCLUDE) $(OPTFLAGS)

OBJS = \
	main.o\
	dispatch.o\
	server.o\
	chat.o\
	client.o

nuchat : $(OBJS)
	$(CC) $(CFLAGS) -o NUChat $(OBJS) $(LDFLAGS)

main.o : main.cpp main.h
	$(CC) $(CFLAGS) -c main.cpp -o main.o

chat.o : src/NUChat.cpp src/NUChat.h
	$(CC) $(CFLAGS) -c src/NUChat.cpp -o chat.o

client.o : src/Client.cpp src/Client.h
	$(CC) $(CFLAGS) -c src/Client.cpp -o client.o

dispatch.o : src/Dispatch.cpp src/Dispatch.h
	$(CC) $(CFLAGS) -c src/Dispatch.cpp -o dispatch.o

server.o : src/Server.cpp src/Server.h
	$(CC) $(CFLAGS) -c src/Server.cpp -o server.o

clean:
	rm -f $(OBJS)
		@echo "Build files cleaned"

